#include <stdio.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

int main()
{
    int fd = open("1.txt", O_RDWR);
    int len = lseek(fd, 0, SEEK_END);

    void* ptr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
    if(ptr == MAP_FAILED) {
        perror("mmap error");
        exit(1);
    }

    printf("%s\n", (char*)ptr);
    printf("%p\n", ptr);

    munmap(ptr, len);

    close(fd);

    return 0;
}

